#!/bin/bash

#将/etc/passwd/文件内容，写入数据库

while read line;do
   name=$(echo $line | awk -F: '{print $1}')
   zhan=$(echo $line | awk -F: '{print $2}')
   uid=$(echo $line | awk -F: '{print $3}')
   gid=$(echo $line | awk -F: '{print $4}')
   group=$(echo $line | awk -F: '{print $5}')
   home=$(echo $line | awk -F: '{print $6}')
   bash=$(echo $line | awk -F: '{print $7}')
    mysql -u root -pWWW.1.com 2> /dev/null -e "insert into jiaowu.passwd(name,zhan,uid,gid,\`group\`,home,bash) value('$name','$zhan','$uid','$gid','$group','$home','$bash')"


    done < /etc/passwd
